//: PaymentMethodHandler.java 05.09.2008 11:25:43Z apt $
package com.devunion.salon.core.enumeration;

import org.apache.struts.util.MessageResources;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Timoshenko Alexander
 */
public class PaymentMethodHandler {
    private List<String> cards = new ArrayList<String>();
    private List<String> cache = new ArrayList<String>();
    private List<String> check = new ArrayList<String>();
    private List<String> giftcard = new ArrayList<String>();


    public void init() {
        MessageResources resources = MessageResources.getMessageResources("ApplicationResources");
        cards.add(resources.getMessage("modal.add.transaction.payment.amex"));
        cards.add(resources.getMessage("modal.add.transaction.payment.visa"));
        cards.add(resources.getMessage("modal.add.transaction.payment.mastercard"));

        cache.add(resources.getMessage("modal.add.transaction.payment.cache"));

        check.add(resources.getMessage("modal.add.transaction.payment.cheque"));

        giftcard.add(resources.getMessage("modal.add.transaction.payment.giftcard"));
    }

    public List<String> getCards() {
        return cards;
    }

    public void setCards(List<String> cards) {
        this.cards = cards;
    }

    public List<String> getCache() {
        return cache;
    }

    public void setCache(List<String> cache) {
        this.cache = cache;
    }

    public List<String> getCheck() {
        return check;
    }

    public void setCheck(List<String> check) {
        this.check = check;
    }

    public List<String> getGiftcard() {
        return giftcard;
    }

    public void setGiftcard(List<String> giftcard) {
        this.giftcard = giftcard;
    }

    public Boolean containsCach(String method) {
        for (String cach : cache) {
            if (cach.equalsIgnoreCase(method)) {
                return Boolean.TRUE;
            }
        }

        return Boolean.FALSE;
    }

    public Boolean containsCard(String method) {
        for (String cach : cards) {
            if (cach.equalsIgnoreCase(method)) {
                return Boolean.TRUE;
            }
        }

        return Boolean.FALSE;
    }

    public Boolean containsCheck(String method) {
        for (String cach : check) {
            if (cach.equalsIgnoreCase(method)) {
                return Boolean.TRUE;
            }
        }

        return Boolean.FALSE;
    }

    public Boolean containsGiftcard(String method) {
        for (String cach : giftcard) {
            if (cach.equalsIgnoreCase(method)) {
                return Boolean.TRUE;
            }
        }

        return Boolean.FALSE;
    }
}
